package com.afkx.oop.demo8;

/**
 * @ClassName 天师
 * @Description TODO
 * @Author Kx
 * @Date 2025/3/4 19:17
 * @Version 1.0
 */
public class TaoistMaster extends Person{
    public TaoistMaster(String name) {
        super(name);
    }

    @Override
    public void open() {
        System.out.println(super.getName() + "打开门");
    }

    @Override
    public void close() {
        System.out.println(super.getName() + "关闭门");
    }

    public void exorcise(Door door){
        String name = door.getName();
        if(door instanceof Exorcise){
            System.out.println("天师可以用" + name + "捉妖");
        }else {
            System.out.println("天师不可以用" + name + "捉妖");
        }
    }
}
